package com.lry.points.mq;

import com.lry.consumer.ConsumeStatus;
import com.lry.consumer.MessageListenerConcurrently;
import com.lry.message.MessageExt;
import com.lry.mqstarter.annotation.RocketMQListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;


@Slf4j
@Component
@RocketMQListener(topic ="topic", consumerGroup = "PointsAdjustGroup", instanceName = "PointsAdjustMqInstance")
public class PointsAdjustListener implements MessageListenerConcurrently {

    private int pushThreshold = 15;

    public final static String LOG_PREFIX = "积分调整mq监听：";


    @Override
    public ConsumeStatus consumeMessage(List<MessageExt> list) {

        boolean bool = true;
        for (MessageExt msg : list) {
            log.info(LOG_PREFIX+new String(msg.getBody()));
        }

        if (bool) {
            return ConsumeStatus.CONSUME_SUCCESS;
        } else {
            return ConsumeStatus.RECONSUME_LATER;
        }
    }

}
